#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import yaml

def get_config(file_name):
    """
    解析yaml
    return dict
    """
    if not os.path.exists(file_name):
        return {}

    with open(file_name, "r") as f:
        return yaml.load(f)

if __name__ == "__main__":
    config = get_config("oss.yaml")

    json_obj = __import__('json')

    #python3 json.dumps 默认为utf-8 没有字段encoding
    #print(json_obj.dumps(config, encoding='utf-8', indent=4, ensure_ascii=False))
    print(json_obj.dumps(config, indent=4, ensure_ascii=False))
